﻿
@page
@model AdminUI.Pages.BaseData.TenantAccountModel
@{
    var F = Html.F();
}

@section body {
    <f:Panel ID="Panel1" BodyPadding="5" ShowBorder="false" Layout="VBox" ShowHeader="false" IsViewPort="true">
        <Items>
            <f:Grid ID="Grid1" BoxFlex="1" ShowBorder="true" ShowHeader="false" EnableTextSelection="true" EnableColumnLines="true" EnableMultiSelect="false" DataIDField="ID" DataTextField="ModuleName" DataSource="@ViewBag.DataSource" >
                <Toolbars>
                    <f:Toolbar ID="Toolbar1" ToolbarAlign="Right" ItemSpace="1">
                        <Items>
                            <f:Button ID="btnAdd" IconAlign="Left" EnableDefaultState="false" IconFont="_Plus" Text="新增" OnClientClick="onAddClick();"></f:Button>
                            <f:ToolbarSeparator></f:ToolbarSeparator>
                            <f:Button ID="btnEdit" IconAlign="Left" EnableDefaultState="false" IconFont="_Edit" Text="编辑" OnClientClick="onEditClick();"></f:Button>
                            <f:ToolbarSeparator></f:ToolbarSeparator>
                            <f:Button ID="btnDelete" IconAlign="Left" EnableDefaultState="false" IconFont="TrashO" Text="删除" OnClientClick="onDeleteClick();"></f:Button>
                            <f:ToolbarSeparator></f:ToolbarSeparator>
@*                             <f:Button ID="btnChangeEnableUsers" IconAlign="Left" EnableDefaultState="false" IconFont="_Tag" Text="状态">
                                <Menu>
                                    <f:MenuButton ID="btnEnableUsers" Text="启用" OnClientClick="onEnableClick();"></f:MenuButton>
                                    <f:MenuButton ID="btnDisableUsers" Text="禁用" OnClientClick="onDisableClick();"></f:MenuButton>
                                </Menu>
                            </f:Button> *@
                            <f:ToolbarSeparator></f:ToolbarSeparator>
                            <f:Button ID="btnRefresh" IconAlign="Left" EnableDefaultState="false" IconFont="_Refresh" Text="刷新" OnClientClick="onRefreshClick();"></f:Button>
                            <f:ToolbarFill ID="ToolbarFill1"></f:ToolbarFill>
                        </Items>
                    </f:Toolbar>
                </Toolbars>
                <Columns>
                    <f:RowNumberField HeaderText="#" TextAlign="Center" />
                    <f:RenderField HeaderText="ID" DataField="ID" FieldType="Int" Hidden="true" Width="80" TextAlign="Center" />
                    <f:RenderField HeaderText="租户ID" DataField="TID" Hidden="true" FieldType="Int" Width="80" TextAlign="Right" />
                    <f:RenderField HeaderText="银行名称" DataField="BankName" Width="100" />
                    <f:RenderField HeaderText="开户名称" DataField="AccountName" Width="200" />
                    <f:RenderField HeaderText="银行账号" DataField="AccountNo" Width="260" TextAlign="Center" />
				@* 	<f:RenderField HeaderText="排序" DataField="SortFlag" FieldType="Int" Width="50" TextAlign="Center" />
        			<f:RenderCheckField HeaderText="启用" DataField="IsEnable" RenderAsStaticField="true" Width="50" TextAlign="Center" /> *@
                </Columns>
            </f:Grid>
        </Items>
    </f:Panel>
    
    <f:Window ID="Window1" IsModal="true" Hidden="true" Target="Top" EnableResize="true" EnableMaximize="true" EnableIFrame="true" Width="500" Height="450">
        @*<Listeners>
            <f:Listener Event="close" Handler="onWindowClose('refresh');"></f:Listener>
        </Listeners>*@
    </f:Window>
}

@section script {
	<script src="~/res/js/grid.js"></script>
    <script src="~/res/third-party/jspciyl/preview.js"></script>
    <script>
        function onAddClick(event) {
            var path = "/BaseData/TenantAccountAdd?tid=@Model.TenantID";
            F.ui.Window1.show(path, '新增银行账户');
        }

        function onEditClick(event) {
            var grid1 = F.ui.Grid1;
            if (!grid1.hasSelection()) {
                showNotify('请选择要修改的记录！');
                return;
            }

            var selectedRow = grid1.getSelectedRow();
            var path = "/BaseData/TenantAccountEdit?id=" + selectedRow;
            F.ui.Window1.show(path, '编辑银行账户');
        }

        function onDeleteClick(event) {
            var grid1 = F.ui.Grid1;
            if (!grid1.hasSelection()) {
                showNotify('请选择要删除的记录！');
                return;
            }

            var selectedRows = grid1.getSelectedRows();
            F.confirm({
                message: '确定要删除所选记录吗？',
                target: '_top',
                ok: function () {
                    F.doPostBack('@Url.Handler("Grid_DoAction")', 'Panel1', {
                        actionType: 'delete',
                        tid:@Model.TenantID,
                        selectedIDs: selectedRows
                    });
                }
            });
        }
       
        function onRefreshClick() {
            var grid1 = F.ui.Grid1;
            var selectedRows = grid1.getSelectedRows();
            F.doPostBack('@Url.Handler("Grid_DoAction")', 'Panel1', {
                actionType: 'refresh',
                tid:@Model.TenantID,
                selectedIDs: selectedRows
            });
        }

       
    </script>
}

